<style>

</style>
<div id="core-pay-modal" class="modal fade" tabindex="-1" style="z-index:99999;display:none">
<div class="modal-dialog" style="width:100%;left:0%;bottom:0;">
<div class='modal-content' style="padding-bottom:0.6rem;border-bottom-left-radius:0;border-bottom-right-radius:0;">
		<div class='fui-page-title bold c' style="padding-top:1.3rem;padding-bottom:0;font-size:1rem">支付订单</div>
		<div class='fui-page-title bold c'><span>￥</span><span class="bigprice core-pay-fee" style="font-size:1.6rem">{{paydata.fee}}</span></div>
		<div class='fui-page-title c subtitle' style="margin-top:-0.3rem">订单编号:<span class="core-pay-ordersn">{{paydata.tid}}</span></div>
		<div class="weui_cells weui_cells_radio2" style="margin-top:10px;max-height:18rem;overflow-y:scroll">
			<label ng-if="paydata.iswechat==1 && paydata.fee>0" class="weui_cell weui_check_label" for="type" pay_type="wechat">
					<div class='weui_cell_hd' style="width:auto;">
						<i class="icon icon-weixin green" style="font-size:1.6rem"></i>
					</div>
					<div class="weui_cell_bd weui_cell_primary">
						<div class="title bold">微信支付</div>
					</div>
					<div class="weui_cell_ft" ng-click="paydata.type='wechat'">
						<input type="radio" name="type" id="type" class="weui_check" ng-checked="paydata.type=='wechat'">
						<span class="weui_icon_checked"></span>
					</div>
			</label>
			<label ng-if="paydata.iscredit==1 && paydata.credit2.isdi!=1" class="weui_cell weui_check_label">
					<div class='weui_cell_hd' style="width:auto;">
						<i class="icon icon-icon green" style="font-size:1.6rem"></i>
					</div>
					<div class="weui_cell_bd weui_cell_primary">
						<div class="title bold">余额支付 <span>（可用 <span class='text-danger'>￥{{paydata.credit || '0.00'}}</span>）</div>
					</div>
					<div class="weui_cell_ft" ng-click="paydata.type='credit'">
						<input type="radio" name="type" class="weui_check" ng-checked="paydata.type=='credit'">
						<span class="weui_icon_checked"></span>
					</div>
			</label>
			<div ng-if="paydata.iscredit==1 && paydata.credit2.isdi==1" class="weui_cell">
					<div class='weui_cell_hd' style="width:1.6rem;">
						
					</div>
					<div class="weui_cell_bd weui_cell_primary">
						余额(可用 <span class='text-danger'>￥{{paydata.credit2.value || '0.00'}}</span>)
					</div>
					<div class="weui_cell_ft">
						-{{windows.paydata.credit2.difee || '0.00'}}
						<span style="width:2rem"><input class="weui_switch" type="checkbox" ng-checked="ifelse(paydata.credit2.di_open==1,true,false)" ng-click="toogle(paydata.credit2,'di_open',[1,0])"></span>
					</div>
			</div>
			<div ng-repeat="item in paydata.creditdata" ng-class="{'weui_cell':1,'disabled':item.value<=0}">
					<div class='weui_cell_hd' style="width:1.6rem;">
						
					</div>
					<div class="weui_cell_bd weui_cell_primary">
						{{item.title}}（可用 <span class='text-danger'>￥{{item.value || '0.00'}}</span>）
						
					</div>
					<div class="weui_cell_ft">
						<span style="margin-right:0.3rem">-{{item.difee || '0.00'}}</span>
						<input class="weui_switch" type="checkbox" ng-checked="paydata.di_open==item.field" ng-click="toogle(paydata,'di_open',[item.field,0])">
					</div>
			</div>
			<label ng-if="paydata.isalipay==1 && paydata.fee>0" class="weui_cell weui_check_label" for="type">
					<div class='weui_cell_hd' style="width:auto;">
						<i class="icon icon-qianbaopengyou green" style="font-size:1.6rem"></i>
					</div>
					<div class="weui_cell_bd weui_cell_primary">
						<div class="title bold">支付宝支付</div>
						<div class="subtitle">使用支付宝进行支付</div>
					</div>
					<div class="weui_cell_ft" ng-click="paydata.type='alipay'">
						<input type="radio" name="type" id="type" class="weui_check" ng-checked="paydata.type=='alipay'">
						<span class="weui_icon_checked"></span>
					</div>
			</label>
			<label ng-if="paydata.ishdfk==1 && paydata.fee>0" class="weui_cell weui_check_label" for="type">
					<div class='weui_cell_hd' style="width:auto;">
						<i class="icon icon-tianmaohuodaofukuan green" style="font-size:1.6rem"></i>
					</div>
					<div class="weui_cell_bd weui_cell_primary">
						<div class="title bold">货到付款</div>
						<div class="subtitle">收到商品后进行付款</div>
					</div>
					<div class="weui_cell_ft" ng-click="paydata.type='hdfk'">
						<input type="radio" name="type" id="type" class="weui_check" ng-checked="paydata.type=='hdfk'">
						<span class="weui_icon_checked"></span>
					</div>
			</label>
        </div>
		<a href="javascript:;" ng-click="new_gotopay();" class="weui_btn weui_btn_primary" style="margin:0.5rem 1rem;border-radius:1rem">确认支付</a>
</div>
</div>
</div>
<script>
scope.new_gotopay=function(){
	if(!scope.paydata.type){
		scope.message('请选择支付方式！');
		return false;
	}
	var pay_type=scope.paydata.type;
	scope.tool.pay(scope.paydata.id,function(res){
			console.log('new_gotopay');console.log(res);
			var complete_url= scope.paydata.complete_url?scope.paydata.complete_url:'';
			var fail_url= scope.paydata.fail_url?scope.paydata.fail_url:complete_url;
			console.log('new_gotopay');console.log(complete_url);
			if(res.type=='success'){
					scope.message('支付成功！','success',complete_url);
			}else{
					scope.message('支付失败！','success',fail_url);
			}
	},pay_type);
	$('#core-pay-modal').modal('hide');
}
</script>